class Solution(object):
    def twoSum(self, nums, target):
        n = len(nums)
        for i in range(0, n):
            for j in range(i + 1, n):
                if nums[i] + nums[j] == target:
                    return [i, j]
        return []               
        
class Solution(object):
    def twoSum(self, nums, target):
        ht = dict()
        for i, num in enumerate(nums): # 为什么要同时读取它的值和座标呢？通过这种方法来
            if target - num in ht:
                return [ht[target - num], i]
            ht[num] = i            
        return []
                
        
